﻿@model GameCode.Models.Admin.GameProjectModel
@{
    ViewBag.Title = "游戏特权 - 游戏项目";
    Model.Caption = "游戏项目";
    Model.NewLink = "/Admin/GameProjectEdit?isNew=true";
    Layout = "~/Views/Shared/_AdminLayout.cshtml";
}
@using (Html.BeginForm(new { act = "submit" }))
{
    <div class="ui-bar ui-bar-a">
        条件
    </div>
    <div class="ui-body ui-body-a site-content-search">
        <div data-role="fieldcontain">
            @Html.LabelFor(m => m.GameName)
            @Html.TextBoxFor(m => m.GameName, new Dict() { "data-mini:true" })
            @Html.ValidationMessageFor(m => m.GameName, new { style = "color:Red" })
        </div>
        <div data-role="fieldcontain">
            @Html.LabelFor(m => m.ProjectName)
            @Html.TextBoxFor(m => m.ProjectName, new Dict() { "data-mini:true" })
            @Html.ValidationMessageFor(m => m.ProjectName, new { style = "color:Red" })
        </div>
        <div data-role="fieldcontain">
            @Html.CheckBoxFor(m => m.Effective, new Dict() { "data-mini:true" })
            @Html.LabelFor(m => m.Effective)
            @Html.ValidationMessageFor(m => m.Effective, new { style = "color:Red" })
        </div>
        <input type="submit" value="搜索"  data-inline="true" data-mini="true"  />
    </div>
    
    
       var grid = new WebGrid(source: Model.List,canPage:false);
    @grid.GetHtml(
        htmlAttributes: new { cellpadding = "0", cellspacing = "0" },
        headerStyle: "ui-li ui-li-divider ui-btn ui-bar-a ui-btn-hover-undefined ui-btn-up-undefined",
    columns: grid.Columns
        (
            grid.Column("ProjectNr", "项目编号"),
            grid.Column("ProjectName", "项目名称"),
            grid.Column("GameName", "游戏名称"),
            grid.Column(header: "图片", format: (item) => Html.Raw(string.Format("<img src='{0}' height=25 width=70>", item.LogoLink == null ? "" : item.LogoLink)), canSort: false),
            grid.Column(header: "顺序", format: (item) => Html.Raw(string.Format(
                @"{1}<a href='\Admin\GameProjectUp?id={0}'><img src='\Content\themes\admin\images\up.png' ></a><a href='\Admin\GameProjectDown?id={0}'><img src='\Content\themes\admin\images\down.png' ></a>",
                item.ID, item.Seq
            ))),
            grid.Column(header: "上下架", format: (item) => Html.ActionLink(item.Effective ? "下架" : "上架", "GameProjectEffective", new { id = item.Id }), canSort: false),
            grid.Column(header: "编辑", format: (item) => Html.ActionLink("编辑", "GameProjectEdit", new { id = item.Id, isNew = false }), canSort: false),
            grid.Column(header: "复制到新项目", format: (item) => Html.ActionLink("复制到新项目", "GameProjectEdit", new { id = item.Id,isNew=true }), canSort: false),
            grid.Column(header: "删除", format: (item) => Html.ActionLink("删除", "GameProjectDelete", new { id = item.Id }), canSort: false)
        )
    )
}